package com.hankol.winecellar.utils

import com.baselibrary.MessageBus
import com.baselibrary.utils.EventBusUtils
import com.hankol.winecellar.bean.CommentEventBusBean
import com.hankol.winecellar.bean.PublishEventBusBean

/**
 * @author: 关忆北、
 * @date: 2022/2/25
 * @Des：废弃，后边都挪到【Constants类】
 */
class BaseConstant {
    companion object {
        const val USER_ID = "userId"
        const val USER_PAGE_POS = "currentIndex"//用户主页--收藏
        const val SYSTEM_TYPE = "SYSTEM_TYPE"
        const val ATTENIVE_INDEX = "type"
        const val PUBLISH_PLUS = "首页点击加号发布"
        const val PUBLISH_TOPIC = "在话题页面发布"
        const val PUBLISH_FOLLOW = "分享生活"
        const val PUBLISH_WINE_CELLAR = "酒窖"
        const val PUBLISH_WINE_CELLAR_NEW = "经营者中心--酒窖"
        const val POINT_USERINFO_FOLLOW = "个人主页"
        const val POINT_DYNAMIC_COLLECTION = "收藏页面"
        const val POINT_DYNAMIC_FOLLOW = "关注页面"
        const val POINT_DYNAMIC_GIVE_COL = "赞和收藏页面"
        const val POINT_DYNAMIC_COM_MY = "评论我的"
        const val POINT_DYNAMIC_MY_PUBLISH = "我发布的动态页面"
        fun loadPublishPlus(): MessageBus {
            val bean: PublishEventBusBean = PublishEventBusBean()
            bean.publishType = PUBLISH_PLUS
            val builder = MessageBus.Builder()
            return builder
                    .codeType(MessageBus.msgid_publish_dynamic_type)
                    .message(bean)
                    .build();
        }

        fun loadPublishTopic(topicId: Long, topicName: String): MessageBus {
            val bean: PublishEventBusBean = PublishEventBusBean()
            bean.publishType = PUBLISH_TOPIC
            bean.typeId = topicId
            bean.typeName = topicName
            val builder = MessageBus.Builder()
            return builder
                    .codeType(MessageBus.msgid_publish_dynamic_type)
                    .message(bean)
                    .build();
        }

        fun loadPublishFOLLOW(): MessageBus {
            val bean: PublishEventBusBean = PublishEventBusBean()
            bean.publishType = PUBLISH_FOLLOW
            val builder = MessageBus.Builder()
            return builder
                    .codeType(MessageBus.msgid_publish_dynamic_type)
                    .message(bean)
                    .build();
        }

        fun loadPublishWineCellar(wineCellarId: Long): MessageBus {
            val bean: PublishEventBusBean = PublishEventBusBean()
            bean.publishType = PUBLISH_WINE_CELLAR
            bean.typeId = wineCellarId
            val builder = MessageBus.Builder()
            return builder
                    .codeType(MessageBus.msgid_publish_dynamic_type)
                    .message(bean)
                    .build();
        }

        fun loadCommentEventBusBean(positionType: String, commentPageType: String) {
            val bean: CommentEventBusBean = CommentEventBusBean()
            bean.positionType = positionType
            bean.commentPageType = commentPageType
            val builder = MessageBus.Builder()
            val build = builder.codeType(MessageBus.msgId_comment_open)
                    .message(bean)
                    .build();
            EventBusUtils.postSticky(build)
        }
        //经营者中心--发布酒窖动态
        fun loadPublishWinery(wineryCode:String): MessageBus {
            val bean  = PublishEventBusBean()
            bean.publishType = PUBLISH_WINE_CELLAR_NEW
            bean.typeIdStr=wineryCode
            val builder = MessageBus.Builder()
            return builder
                    .codeType(MessageBus.msgid_publish_dynamic_type)
                    .message(bean)
                    .build();
        }

    }
}